package com.example.baweyplayer.receivers;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

import com.example.baweyplayer.Melotonine;
import com.example.baweyplayer.activities.ReleaseActivity;
import com.example.baweyplayer.activities.abstracts.AbstractLibraryActivity;

public class ModeChangedReceiver extends BroadcastReceiver {

	private AbstractLibraryActivity activity;

	public ModeChangedReceiver(AbstractLibraryActivity activity) {
		this.activity = activity;
	}

	@Override
	public void onReceive(Context context, Intent intent) {
		if (intent.getAction().equals(Melotonine.NETWORK_MODE_CHANGED)) {
			Log.d("Networking", "Network mode changed");
			activity.handleModeSwitch();
		} else if(intent.getAction().equals(Melotonine.NETWORK_UNAVAILABLE)){
			Log.d("Networking", "Network unavailable");
			
		}
	}
}
